import { fly } from '@/utils/request';

const control = '/basic/v1';

/**
 * 用户注册(密-密)
 */
export function register(params) {
  return fly.post(`${control}/iocrypt/register`, params, {
    type: 'encrypt',
    output: 'decrypt',
  });
}

/**
 * 用户登录(密-密)
 */
export function login(params) {
  return fly.post(`${control}/iocrypt/login`, params, {
    type: 'encrypt',
    output: 'decrypt',
  });
}

/**
 * 忘记密码重置校验(密-密)
 */
export function resetPwdValid(params) {
  return fly.post(`${control}/iocrypt/resetPwdValid`, params, {
    type: 'encrypt',
    output: 'decrypt',
  });
}

/**
 * 忘记密码重置(密-明)
 */
export function modifyPwd(params) {
  return fly.post(`${control}/incrypt/resetPwd`, params, {
    type: 'encrypt',
    output: '',
  });
}

/**
 * 发送验证码(密-明)   smsType验证码类型: login-登录，register-注册，forgetpwd-忘记密码，changepwd-修改密码, cashaccount = 修改提现账号 getcash=获取提现账号信息
 */
export function sendCode(params) {
  return fly.post(`${control}/incrypt/sendCode`, params, {
    type: 'encrypt',
    output: '',
  });
}

/**
 * 退出登录
 */
export function loginOut() {
  return fly.post(`${control}/logout`, {}, { type: '', output: '' });
}

/**
 * 获取是否开启邀请（及样式数据）
 */
export function getInviteStatus({ pageType }) {
  return fly.post(
    `${control}/getInviteStatus`,
    { pageType },
    { type: '', output: '' }
  );
}
